Skip to content

disable debug logging for h2, reqwest, hyper_util libraries + request id in cli logs#401

Merged
subygan merged 3 commits intomainfrom
disable-h2-log
Mar 30, 2026
Merged

disable debug logging for h2, reqwest, hyper_util libraries + request id in cli logs#401
subygan merged 3 commits intomainfrom
disable-h2-log

Conversation

@subygan
Copy link
Copy Markdown
Contributor

@subygan subygan commented Mar 29, 2026

client side logs are very noisy when run with, RUST_LOG=debug because of logs from h2 library. this PR turns off debug logs from h2.

this can still be enabled by RUST_LOG=debug,h2=debug

  • removes logs from, h2, reqwest and hyper_util.
  • also makes the requestId visible in the client side

this can still be enabled by `RUST_LOG=debug,h2=debug`
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 29, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 26aa7105-7b63-4e51-9bd4-13773df9a2bb

📥 Commits

Reviewing files that changed from the base of the PR and between 8cfd310 and f1f63a1.

📒 Files selected for processing (1)
  • crates/lib/src/util/logging.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • crates/lib/src/util/logging.rs

📝 Walkthrough

Summary by CodeRabbit

  • Chores
    • Improved API request tracking by adding unique identifiers to all debug logs, enabling better correlation and troubleshooting across API operations
    • Enhanced logging configuration with granular per-module filters to reduce noise from third-party libraries and improve overall log readability
    • Adjusted logging verbosity levels across authentication and core API workflows to provide clearer operational visibility during debugging

Walkthrough

Adds a public helper to read the x-oxen-request-id header from HTTP responses, surfaces that request ID in existing debug logs during response parsing and chunk pulls, and tightens logging initialization with per-module filters and one debug→trace loglevel change.

Changes

Cohort / File(s) Summary
Request ID helper & client logs
crates/lib/src/api/client.rs
Added pub fn get_request_id(response: &reqwest::Response) -> &str; use it to include request_id in debug logs for JSON and non-JSON response handling.
Entry download logging
crates/lib/src/api/client/entries.rs
Updated pull_entry_chunk to call client::get_request_id(&response) and include request_id in the debug message for chunk pulls.
Auth config loglevel
crates/lib/src/config/auth_config.rs
Changed log level from debug! to trace! when reporting resolved auth config path.
Logging initialization
crates/lib/src/util/logging.rs
Updated init_logging() to build env_logger::Builder, add per-module LevelFilter rules (force h2, hyper_util, reqwest to Warn), and call parse_env(Env::default()) before init. Formatter and init behavior unchanged.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • Eric-Laurence
  • CleanCut

Poem

🐰 I fetched the header, small and bright,
A tiny id that guides the night.
Logs sing clearer, noise grown thin,
Hush, reqwest—let the truths come in. ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The PR title accurately reflects the main changes: disabling debug logging for h2/reqwest/hyper_util libraries and adding request ID visibility in logs.
Description check ✅ Passed The PR description is directly related to the changeset, explaining the motivation (noisy logs from h2) and describing the key changes (disabling debug logs, making request ID visible).

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch disable-h2-log

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Collaborator

@gschoeni gschoeni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good add, I was getting annoyed by this log too 😅

@subygan subygan marked this pull request as ready for review March 30, 2026 16:04
@subygan subygan changed the title disable debug logging for h2 library. disable debug logging for h2, reqwest, hyper_util libraries + request id in cli logs Mar 30, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@crates/lib/src/util/logging.rs`:
- Around line 20-22: The hardcoded filter_module calls (e.g.,
filter_module("h2", LevelFilter::Warn), filter_module("hyper_util", ...),
filter_module("reqwest", ...)) are overriding any RUST_LOG env directives
because they are applied after Builder::from_env / parse_env; fix by applying
these default filter_module calls before calling parse_env/from_env so
environment-specified log levels can override them (i.e., move the filter_module
lines to occur prior to parse_env/from_env on the Builder, keeping
Builder::from_env/parse_env as the final step).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 0aebef04-a75a-4b03-8280-57cdc4585c35

📥 Commits

Reviewing files that changed from the base of the PR and between cfc81c5 and 8cfd310.

📒 Files selected for processing (4)
  • crates/lib/src/api/client.rs
  • crates/lib/src/api/client/entries.rs
  • crates/lib/src/config/auth_config.rs
  • crates/lib/src/util/logging.rs

@subygan subygan enabled auto-merge (squash) March 30, 2026 16:19
@subygan subygan merged commit c340b5c into main Mar 30, 2026
5 checks passed
@subygan subygan deleted the disable-h2-log branch March 30, 2026 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants